// SimpleCounter.java
package cc.magicjson.example.demo.monitor.mbean;

import javax.management.NotificationBroadcasterSupport;

/**
 * 实现对简单计数MBean接口并实现对JMX发送通知
 */
public class SimpleCounter extends NotificationBroadcasterSupport implements SimpleCounterMBean {
    private int count = 0;
    private String nickName;

    @Override
    public String getNickName() {
        return nickName;
    }

    @Override
    public void setNickName() {
        this.nickName = "nickName";
    }

    @Override
    public synchronized int getCount() {
        return count;
    }

    @Override
    public synchronized void reset() {
        count = 0;
    }

    @Override
    public synchronized void increment() {
        count++;
    }

    @Override
    public synchronized void decrement() {
        count--;
    }

    // 如果需要发送通知，可以在此处添加相关代码
}